#include "dma_adc2pwm.h"
#include "stm32f4xx.h"
#include "stm32f4xx_dma.h"
#include "stm32f4xx_tim.h"

void DMA_ADC_TransportADCData(Device_DMA_ADCToPWM* dv){
    ADC_RegularChannelConfig(dv->ADC_Port, dv->ADC_Channel, 1, ADC_SampleTime_480Cycles);
    ADC_SoftwareStartConv(dv->ADC_Port);
    while(!ADC_GetFlagStatus(dv->ADC_Port, ADC_FLAG_EOC));
    
    dv->PWM_TIM_SetCompareFunc(dv->PWM_TIM_Port, (uint32_t)( (dv->DMA_BufAddr)[0] * dv->PWM_TIM_Period /4095) );
}
